<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="d" uri="/WEB-INF/resource.tld" %>
<!DOCTYPE html>
<html lang="zh-CN">
  
  <head>
    
    <%@ include file="/WEB-INF/include/meta.jsp"%>
    <%@ include file="/WEB-INF/include/css.jsp"%>
    
  </head>
  <!-- end header -->
  <body>
    <div class="page-group">
      <div class="page page-current">
        
        <div class="content" style="${product.buyable ? 'margin-bottom: 2.7rem;' : ''}">
          
          <div class="product-detial-header">
            <div class="product-detial-banner">
              <img alt="" src="${cloud.prod}/${product.cover}" style="max-width: 100%;">
            </div>
            <div class="product-detial-banner-footer">
              <div class="clearfix">
                <p class="product-labels pull-left clearfix">
                  <c:forEach var="tagMap" items="${product.tags}">
                    <label class="${tagMap.key}">${tagMap.value.name}</label>
                  </c:forEach>
                </p>
                <span class="pull-right amount">销量&nbsp;${product.salesAmount}</span>
              </div>
              <h2 class="product-title">${product.name}${product.course.individual ? product.course.hours : ''}${product.course.individual ? '课时' : ''}</h2>
              <p class="product-description">${product.summary}</p>
              <div class="clearfix">
                <p class="product-price pull-left">
                  <strong class="price"><span>￥</span><fmt:formatNumber value="${product.currentOffer / 100}"  pattern="0.00" maxFractionDigits="2" /></span></strong>
                  <span class="price-old">￥<fmt:formatNumber value="${product.basicOffer / 100}"  pattern="0.00" maxFractionDigits="2" /></span>
                </p>
               <!--  <a href="javascript:void(0);" class="pull-right"><i class="icon icon-fs-share"></i></a> -->
              </div>
            </div>
          </div>
          <!-- End Banner Area -->
          
          <div class="product-detial-tabs"> 
            <div class="buttons-tab fixed-tab fs-tabs" data-offset="44">
              <a href="#description" class="tab-link active button">详情</a>
              <!-- <a href="#consultant" class="tab-link button">咨询</a> -->
            </div>
            <div class="content-block no-margin">
              <div class="tabs">
                <div id="description" class="tab active">
                  <div class="content-block no-margin" style="padding: .6rem 0;">
                    ${product.description}
                  </div>
                </div>
                <div id="consultant" class="tab">
                  <div class="content-block">
                    <p>This is tab 2 content</p>
                    <p>This is tab 2 content</p>
                    <p>This is tab 2 content</p>
                    <p>This is tab 2 content</p>
                    <p>This is tab 2 content</p>
                    <p>This is tab 2 content</p>
                    <p>This is tab 2 content</p>
                    <p>This is tab 2 content</p>
                    <p>This is tab 2 content</p>
                    <p>This is tab 2 content</p>
                    <p>This is tab 2 content</p>
                    <p>This is tab 2 content</p>
                  </div>
                </div>
              </div>
            </div>
            <c:if test="${product.type.online}">
              <div class="to_qa" style="text-align: center;">
                <!-- <img alt="to_qa.png" src="${ctx.host}/resource/image/to_qa.png" style="margin-bottom: 3rem;"> -->
              </div>
              <div class="qa" style="text-align: center;display: none;">
                <img alt="qa.jpg" src="${ctx.host}/resource/image/qa.jpg" width="100%">
              </div>
            </c:if>
          </div>
          <!-- End Tab Area -->
        
        </div>
        <!-- End Content -->
        
        <c:if test="${product.buyable}">
          <c:choose>
            <c:when test="${product.thirdParty eq 'duonang'}">
              <nav class="bar bar-footer product-detail-footer">
                <a href="${ctx.host}/shop?sku=${product.id}&source=index" class="button button-fill button-buy">立即购买</a>
                <a href="#" class="button button-fill button-up"><i class="icon icon-up"></i></a>
              </nav>
            </c:when>
            <c:otherwise>
              <nav class="bar bar-footer product-detail-footer">
                <c:choose>
                  <c:when test="${product.type.others}">
                    <a href="${ctx.host}/shop?sku=${product.id}&source=index&distributorId=${distributorId}" class="button button-fill button-buy">立即购买</a>
                  </c:when>
                  <c:otherwise>
                    <a href="${ctx.host}/shop?sku=${product.id}&source=index&distributorId=${distributorId}" class="button button-fill button-buy">立即购买</a>
                    <%-- <a href="#protocol-push" data-link="${ctx.host}/shop?sku=${product.id}&source=index&distributorId=${distributorId}" data-toggle="push" class="button button-fill button-buy">立即购买</a> --%>
                  </c:otherwise>
                </c:choose>
                <a href="#" class="button button-fill button-up"><i class="icon icon-up"></i></a>
              </nav>
            </c:otherwise>
          </c:choose>
        </c:if>
        <!-- End Footer -->
        
      </div>
    </div>
    
    <%@ include file="/WEB-INF/include/script.jsp"%>
    <d:resource type="script" root="${ctx.resource}/build" src="js/page/product/product-detail.js" />
    <script type="text/javascript">
      require(['page/product/product-detail'], function(page) {
        var data = {
          productId: '${productId}',
          productType: '${product.type.alias}',
          distributorId: '${distributorId}'
        }
        page.init(data)
      })
    </script>
    
  </body>
</html>